home *** CD-ROM | disk | FTP | other *** search
/ Software of the Month Club 1996 June / Software of the Month Club 1996 June.iso / pc / dos / dtp / display / doc / ati_16m.doc next >
Text File  |  1994-03-31  |  8KB  |  195 lines

  1.                 ATI_16M.GRN
  2.             Driver for DJGPP with LIBGRX
  3.         Version 0.31    (C) 1994 Bernhard Schwall
  4.  
  5.  
  6. This is a driver for the ATI Graphics Ultra Plus/Pro to use with the GNU
  7. DJGPP compiler for DOS. To use it set your GO32 environment variable to
  8. ATI_16M.GRN, e.g.
  9. SET GO32=ansi nodpmi d:\djgpp\drivers\ati_16m.grn gw 800 gh 600 nc 256
  10. There are now two compiled versions of the driver included:
  11. ati_16m.grn   for use with your own program
  12. ati_16md.grn  for use with disp180
  13. (For differences see below)
  14.  
  15.  
  16. MODES:
  17. ------
  18.  
  19. The following graphicmodes are supported by the driver:
  20.  
  21. X-Res    Y-Res    number of colors    color setting for Initialisation
  22.  320    200       16               16
  23.  640    200       16               16
  24.  640    350       16               16
  25.  640    480       16               16
  26.  800    600       16               16
  27. 1024    768       16               16
  28.  320    200      256              256
  29.  640    400      256              256
  30.  640    480      256              256
  31.  800    600      256              256
  32. 1024    768      256              256
  33.  640    480    32768            32768
  34.  800    600    32768            32768
  35. 1024    768    32768            32768
  36.  640    480    65536            0xc000+16    (=49168)
  37.  800    600    65536            0xc000+16    (=49168)
  38. 1024    768    65536            0xc000+16    (=49168)
  39.  640    480    16.7 mio.        0xc000+24    (=49176)
  40.  800    600    16.7 mio.        0xc000+24    (=49176)
  41.  
  42. The last three modes are only supported by cards with 2 MB-Ram (I think).
  43. Because I don't use any routine of the LIBGRX graphics-library exept the 
  44. switching to text and graphics-mode I don't know if any routine of this
  45. package will run with the high- and truecolor modes. But you can access the 
  46. video-memory direct. The 16 and 256 color modes work as with the normal
  47. ATI.GRD driver.
  48.  
  49.  
  50. MEMORY-ALIGNMENT:
  51. -----------------
  52. The memory is mapped to two different places in the virtual memory-space. If 
  53. you can use memory-aperutre you can access the memory directly at the mapping-
  54. address. This address can be set direct in the driver (see below). E.g. if
  55. you have set the aperture to MB 9 you can access the memory at address 
  56. 0xe0900000
  57. The other way to access the memory is to use the swapping-mechanism of the
  58. LIBGRX grapfics library (or GO32). You have to use a GO32 version 1.11 or 
  59. above (tested only with 1.11.maint3). There the memory is mapped to 0xd1000000 
  60. for read and write.
  61. So just set a 'char' pointer to this address and access the memory direct.
  62. (see below)
  63. If you use a mode which requires only 1MB you can also use the 'old' memory-
  64. window at 0xd0000000. This will run with GO32 version 1.10a and above (tested
  65. with 1.10a and vmpeg)
  66.  
  67. In modes with 15 or 16 bit (32768 and 65536 colors) each line is twice the
  68. horizontal resolution in byte (e.g. for 640x480: 1280 byte). Two byte 
  69. represent the color-tripple as followd:
  70. 15 bit:    -rrrrrgggggbbbbb    bit 0-4 blue, 5-9 green, 10-14 red, 15 unused
  71. 16 bit:    rrrrrggggggbbbbb    bit 0-4 blue, 5-10 green, 11-15 red
  72.  
  73. In truecolor-modes each line is 3 times the horizontal resolution (e.g. for
  74. 800x600: 2400 byte/line).
  75. The colors are represented by 3 bytes in BGR-order. So if you write to memory
  76. first write the blue, then the green and at last the red value to the memory.
  77. (see example)
  78.  
  79.  
  80. PROGRAMMING:
  81. ------------
  82. To switch to the graphics-mode use the command
  83.  
  84.   GrSetMode(GR_width_height_color_graphics,800,600,0xc000+24);
  85.  
  86. Set the last three parameters to the values you wish (see table above for
  87. parameters).
  88. To switch back to the textmode use the command
  89.  
  90.   GrSetMode(GR_default_text);
  91.  
  92. If your program crashes while a high- or truecolor-mode is set you must reset
  93. your computer because the DOS-command 'mode co80' can't set the card back to
  94. the VGA mode.
  95.  
  96. Because LIBGRX was designed to run with a maximum of 32768 colors (15 bit)
  97. you can't pass the values for 16 and 24 bit via the GO32 setting. For
  98. switching into 16 or 24 bit modes you must set the values directly into the
  99. GrSetMode(...) command.
  100.  
  101. Here is a short example how to access the video memory:
  102.  
  103. #include <grx.h>
  104.  
  105. void main(){
  106.   char *memory;
  107.   long x,y;
  108.   /* switch to mode 800x600x16.7mio */
  109.   GrSetMode(GR_width_height_color_graphics,800,600,0xc000+24);
  110.   
  111.   for (y=0; y<600; y++){
  112.     memory = (char *)0xd1000000+(3l*800l*y);
  113.     /*
  114.       if you can use memory-aperture use: (here for aperture at MB 9)
  115.       memory = (char *)0xe0900000+(3l*800l*y);
  116.     */
  117.     for (x=0; x<800; x++){
  118.       *memory++ = y % 256;    /* blue */
  119.       *memory++ = x % 256;    /* green */
  120.       *memory++ = (x+y) % 256;    /* red */
  121.     }
  122.   }
  123.   GrSetMode(GR_default_text);
  124. }
  125.  
  126.  
  127. CONFIGURING THE DRIVER:
  128. -----------------------
  129. There is only one point you can change in the driver. This is the address for
  130. the memory-aperture. In line 263 you can enable or disable the aperture by
  131. setting AL to 0x02 (enable) or 0x00 (disable). If you enable it you can set
  132. the address in line 265 in AH (from 0-127, on ISA only 0-12). I don't know
  133. what will happen if you set the address into your normal RAM and access it
  134. via 0xd1000000. But I'm shure if you try to access your videomemory through 
  135. e.g. 0xe0100000 your system will crash. 
  136.  
  137. The default settings are:
  138. memory-aperture disabled but set to address MB 9 as example so you can use it
  139. with all boards.
  140. After changing the values you must recompile the driver with TASM (or MASM,
  141. I think), then link it and make it an obj, e.g.
  142.  
  143. TASM ATI_16M.ASM
  144. TLINK            (ignore the warning 'NO STACK')
  145. EXE2BIN ATI_16M.EXE ATI_16M.GRN
  146.  
  147. Now the driver should run on your system.
  148.  
  149. The driver is configured to be used with your own program. If you want to use
  150. it with other programs written for 16 or 24 bit modes perhaps you have to 
  151. change the driver, 15 bit modes should run with the standard settings.
  152. E.g. if you want to use the driver with disp180 with 16 or 24 bit modes you
  153. must comment out line 275 and compile the driver. But this drivers wouln't run
  154. with your programs (with LIBGRX 1.03) in 16 and 24 bit modes. If you try to 
  155. switch in those modes you will get the error-message 'bad color plane # in 
  156. driver' and the program will stop immediately.
  157. The reason for this problem is that LIBGRX was designed for a maximum of 15
  158. colorplanes and it will reject all modes with more than 15 planes. For disp180
  159. LIBGRX was changed (I think) to accept this modes and it uses the # of planes
  160. value returned by the driver to validate the correctness of the videomode.
  161. So you have to support two driver if you want to use disp180 with truecolor
  162. and also want to write your own programs for the drivers.
  163. Another possibility is to change the sourcecode of LIBGRX to support 16 and
  164. 24 bit modes. For LIBGRX 1.03 you have to change the file 'setmode.c' and 
  165. porhaps some other files to make the driver run with it. Caution: if you do so
  166. notice that the file 'grdriver.inc' shipped with LIBGRX is different to the
  167. file used by disp180 (and by the driver).
  168.  
  169.  
  170. ABOUT THE DRIVER:
  171. -----------------
  172. The driver is released without any warranty. It was originally made only for
  173. my own use but I thought it would be usefull for others too. Feel free to send
  174. your comments, hints, changes or reports about this driver. If you have any
  175. problem or question please contact me so I will try to help you.
  176. The driver was tested with disp180 and seems to work in all resolutions.
  177. With a patch it will also work with vmpeg 1.1 but then it will no longer run
  178. with disp180 because vmpeg expects the number of byte per line as horizontal 
  179. resolution.
  180. Because 24 bit display with vmpeg is slower then 8 bit display I removed the
  181. patch so you can use the driver with disp180.
  182. Caution: because the programming of 15, 16 and 24 bit modes seems not to be 
  183. standardized you should always use the go32 version shipped with the program
  184. you want to use.
  185.  
  186.  
  187. AUTHOR:
  188. -------
  189.  
  190. Bernhard Schwall
  191. Broichstr.56
  192. D-53227 Bonn
  193.  
  194. e-mail: schwall@athene.informatik.uni-bonn.de
  195.